/**
 * @fileOverview book view
 * @author: burning <iburning@live.cn>
 * @date: 2015-09-07
 */

var app = app || {};

app.BookView = Backbone.View.extend({
  tagName: 'div',
  className: 'bookContainer',
  template: _.template( $('#bookTemplate').html() ),

  render: function () {
    this.$el.html( this.template( this.model.toJSON() ) );
    return this;
  },

  events: {
    'click .delete': 'deleteBook'
  },

  deleteBook: function () {
    // Delete model
    this.model.destroy();

    // Delete view
    this.remove();
  }
});
